import 'package:flutter/material.dart';

class BottomNavigationBarPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => BottomNavigationState();
}

class BottomNavigationState extends State<BottomNavigationBarPage> {
  int _currentIndex = 0;

  @override
  void initState() {
    super.initState();
  }

  _onTapHandle(int index) {
    setState(() {
      _currentIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return BottomNavigationBar(
        onTap: _onTapHandle,
        fixedColor: Colors.black,
        type: BottomNavigationBarType.fixed,
        currentIndex: _currentIndex,
        items: [
          BottomNavigationBarItem(
              icon: Icon(
                Icons.directions_bike,
              ),
              title: Text("漂移")),
          BottomNavigationBarItem(
              icon: Icon(
                Icons.favorite,
              ),
              title: Text("收藏")),
          BottomNavigationBarItem(
              icon: Icon(
                Icons.contacts,
              ),
              title: Text("联系人")),
          BottomNavigationBarItem(
              icon: Icon(
                Icons.person,
              ),
              title: Text("我的")),
        ]);
  }
}
